package com.example.prototype;

/**
 * Created by fjx on 2021/6/17
 */
public class TestMain {


    public static void main(String[] args) {
        Person person = new Person();
        person.setId(123);

        try {
            Person clone = person.clone();
            clone.setName("lao");
            clone.setId(3);
            System.out.println(person);
            System.out.println(clone);

        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }

        Person deepClone = new Person();
        deepClone.setId(1);

        Person deepCloneObject = deepClone.deepClone();
        System.out.println(deepCloneObject);
    }
}
